package com.shanzmoo.merchant.manage.api.config;

import com.shanzmoo.db.common.inface.UserComponentInface;
import com.shanzmoo.merchant.manage.api.domain.AuthUser;
import com.shanzmoo.merchant.manage.api.util.SecurityUtil;
import org.springframework.stereotype.Component;

/**
 * 用户id获取组件
 * @author fs
 */
@Component
public class UserComponent implements UserComponentInface {

    @Override
    public Integer getUserId() {
        return SecurityUtil.getCurrentUserId();
    }

    public String getMerchantCode() {
        AuthUser user = SecurityUtil.getCurrentUser();
        return user.getMerchantCode();
    }
}
